package com.baizhi.set;

import java.util.HashSet;
import java.util.Set;

public interface SetDmo02 {
    public static void main(String[] args) {
        /*
         集合中存放的是地址，

         */
        Set<Student> set = new HashSet<>();
        Student st1 = new Student("张三",18);
        Student st2 = new Student("张三",18);

        set.add(st1);
        set.add(st2);

        System.out.println(set);
        System.out.println(st1.hashCode());
        System.out.println(st2.hashCode());

        System.out.println("======================");



        Set<String> set2 = new HashSet<>();
        String s1 = "abc";
        String s2 = "abc";

        System.out.println(s1==s2); //true

        set2.add(s1);
        set2.add(s2);
        System.out.println(set2);
        System.out.println(s1.hashCode());
        System.out.println(s2.hashCode());




    }
}
